export default function(options) {
	uni.showLoading({
		title: '拼命加载中'
	})
	let token = uni.getStorageSync("token");
	uni.request({
		url: uni.getStorageSync("server_url") + options.url,
		method: options.method || 'get',
		data: options.data || [],
		header:{token},
		success: (res) => {
			if (res.data.code === 200) {
				options.success(res.data)
			} else if(res.data.code===403){
				uni.showToast({
					title:"错误提示：请先登录！",
					icon:'none',
					success: (res) => {
						setTimeout(function(){
							uni.navigateTo({
								url:"/pages/login/login"
							})
						},2000);
					}
				})				
			} else {
				uni.showToast({
					title: '错误提示：' + res.data.msg,
					icon: 'none',
					duration: 3000
				})
			}
		},
		fail: () => {
			uni.showToast({
				title: '调用接口失败',
				icon: 'none',
				duration: 3000
			})
		},
		complete: () => {
			uni.hideLoading()
		}
	})
}